Feature/refactor out code issues

Fix some coding issues