Added queue and cleaned up js a little