Cleaned up and (hopefully) more stable