Code clean up + documenting