refactor, cleaner code
code formatted