Tweak to use modules and common functions