fix indetenaation errors and code layout