fix module resolution and file writing
implement a couple tests