added metadata storage support and fixed scope issue in serialization
added mozilla JS style implementation