Minor adjustements to code to clean it up