Changed some formatting and abstracted definitions