fixed few bugs and added few improvements