moved most code out of __init__.py into dedicated modules