Syntax fixings
Moved if function to corelib and refactored spacing