Added a few variable to handle the placement of the if condition to change the y of the layer