Tests, comments and bug fixes added