Implemented scan terminate by user, added comments