Revert ced618a..ef5010b

This rolls back to commit ced618a853f0140a37e6bf0bd9ac4699d16112ed.
Fixed boundaries problem