Refactored code

Remove all static variables from non static classes
Small performance optimization