Fix and refactor block positioning