cleaned up parser; allow multiple layers