refactored

so i couldnt resolve the bug in python code i wrote in C