Please move this to a seperate file, this file now have over 600 lines and is very hard to read.