add test code
Moved the func. that checking for the 'end' and 'start'  to __init__()