updated readme and refined some code