Adding code from gae-boilerplate