Code Cleanup

Code massively adjusted, taint issues should be fully solved.