adding source and some cleanup