Added a bunch of probably flawed logic

Fix it tomorrow