main code moved to ./src

some code shuffle for better structure