starting to port my broken code