updated code after meeting, more to come