#15: shortened few lines; fixed few bugs. issue can be closed