disable layout on ajax calls+code cleanup