added first rev of custom code, written in javacript