moved intialization code into separate module for easier debugging and testing