reorganize, try and fix javascript errors with loading order