minor refactoring, looks a bit better now