Added basic settings & cleaned up the code