Merge pull request #40 from kynm/refactor_code

fix controller