Added Version Check. Plus massic code clean up