some refactoring to sutisfy the compiler