migrated code from grunt, not tested yet