more splitting up of javascript functions