restructure and cleanup code
remove unneeded dependencies