Fixed some issues, and wrote full working test plugin