more improvements
split into multiple files