Small corrections
Ranamed several variables for unified code style.
Added testmethods. Several formatting corrections.
Resolved conflicting merges