abstracted a bit