More templates for SWIG
Fix layer indexing