fixed compiler errors, small refactor