Updated to work properly with frontend code