Fix inconsistent code + cleanup