minor javascript refactoring
minor refactoring, addition of gems