BUG FIX: updated code to work after the refactor