adding some tests
refractoring
adding more documentation