Fixed issue 21, 25 and other minor issues