Added rotation support. Bug fixes.