modified file for issue #1 and #5 and added file for issue #4