Atmos work

Fix bugs in code