Code clean-up. Grouped specific functions into modules.