Improved brick snapping + some refactorings