Some refactoring + cleanup
small cleanup
minor cleanup
minor refactoring