cleaned up js structure