adding simple hooks to map javascript code