some ruby solutions and js p7 optomization