added common.h
added mac osx implementation