Added features; fixed critical bug