Andy : Reformatted code following Crockford's conventions.