More code optimization

Fixed some issues with the gallery coding as well as the forms.