Keeps theta between 0 and 2pi