started most of the code. just need to implement the actual sql query