Syntax cleanup and overall functioning