more editing and bugs fixing