I almost have it working locally but still catching edge cases here and there