Code cleanup, but still not working