normalizing code and fixing minor stuff