Refactor some control functions
Refactor out references to Data.Map