Added a shitload of duplicate code. Sorry about that