Kinda cleaned up code