Oh, and all this access related code should probably be moved out to a separate file.