Issue #24: Code restructure