Impl shift logic. But bad. Need refactoring.