hacky fixes, take a second look later but the rough version is ready