ABM code for Masters thesis