add scope removal functionality
fixed behaviour at beginning and end of line