bug fixes
bug fixes
rewriting the code in a readable way