fixing some pattern matching warnings
some small optimizations, given that we do not yet have modul.exports