Some small optimazions