updated classes to be more flexible