Change sqlite for pg, add guard, spork support, change layout