fixing code, removing hardcoding