more needs to be written, but this is a start