Attempt to simplify js