initial skeleton stolen from arindb