split everything up into the lib directory and add messenger module