cleaned up code by some refactoring