refactored
added debug and fixed null pointer bug
edited README