Modified to use pg... correctly this time?