optimize code and prepare for initial packaging