Removed UI code and refractored lib