lab working, similar to professors solution