moved all the code to separate file to prevent issues during installing