Restructure for Karma testing