Clean up the leap code a little bit