Minor code improvements
Added check if buttons is inside of footer
Changed classes ordering