Fixed issue #17 #14 and worked on #16