Had to move these functions up to satisfy jslint