Merge branch 'zecke/features/amr'

Fix AMR support for the BSC, remove code duplication, make it
less prone to error.